package cn.edu.scau.cmi.zenghanxiong.simpleFactoryMethod;

import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.ResourceBundle;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.control.ChoiceBox;
import cn.edu.scau.cmi.zenghanxiong.simpleFactoryMethod.*;
import cn.edu.scau.cmi.zenghanxiong.simpleFactoryMethod.domain.*;

public class MeatFactoryController {
	@FXML
	private Button myButton;
	@FXML
	private TextField myTextField;
	@FXML
	private Button beefButton;
	@FXML
	private Button porkButton;
	@FXML
	private Button chickenButton; 
	public void showMeat(ActionEvent event) {
		Meat meat=null;
		Object obj=event.getSource();
		if(obj==beefButton) {
			meat=new Beef();
			myTextField.appendText(meat.cook()+'\n');
		}
		if(obj==porkButton) {
			meat=new Pork();
			myTextField.appendText(meat.cook()+'\n');
		}
		if(obj==chickenButton) {
			meat=new Chicken();
			myTextField.appendText(meat.cook()+'\n');
		}
	}
}
